<html>
<head>
	<script type="text/javascript">
		var aJaxURL	= "server-side/report/money_transfer.action.php";		//server side folder url
		var tName	= "report";												//table name
		var fName	= "add-edit-form";										//form name
		$error = '';
		$data = '';
		
		$(document).ready(function () {  
			AjaxSetup1();
			GetDateTimes("search_start");
			GetDateTimes("search_end");
			
			$("#search_start").val(GetDateTime(2) + " 00:00");
			$("#search_end").val(GetDateTime(2)  + " 23:59");
			
			var start	= $("#search_start").val();
			var end		= $("#search_end").val();
			
			LoadTable(start, end);  

			SetEvents("add_button", "delete_button", "check-all", tName, fName, aJaxURL);   

		});
        
		function LoadTable(start, end){
			var total = [3,4];
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable(tName, aJaxURL, "get_list", 13, "start=" + start + "&end=" + end, 0, "", 1, "desc", total);
			$(".search_init").css("width", "80%");
			GetInfo(start, end);
		}

		function LoadDialog(){		
			/* Dialog Form Selector Name, Buttons Array */
			var buttons = {
			        "print": {
			            text: "ბეჭდვა",
			            id: "print_button",
			            icons: {
			                primary: "ui-icon-print"
			            },
			            click: function () {
			            }
			        },	
					"close": {
						text: "დახურვა",
						id: "close",
						click: function() {
							 $(this).dialog("close");
						}
					}
				};
		        	
			GetDialog(fName, 500, "auto", buttons, "");			
		}

		
	    $(document).on("click", "#print_button", function () {
		    
	    	var transfer_id = $("#transfer_id").val();
	    	

	    	var link = $(this).attr("str");
	    	link = "server-side/print/print_money_transfer.php?transfer_id=" + transfer_id;
	    	
	    	var newWin = window.open(link, "JSSite", "width=800,height=800,resizable=yes,scrollbars=yes,status=yes");
	    	newWin.focus();
	    	newWin.onload = function() {
	    		newWin.print();
	    		setInterval(function(){newWin.close()},500);
		    }
	    });
	    

		
		
	    $(document).on("change", "#search_start", function () {
	    	var start	= $(this).val();
	    	var end		= $("#search_end").val();
	    	LoadTable(start, end);
	    });
	    
	    $(document).on("change", "#search_end", function () {
	    	var start	= $("#search_start").val();
	    	var end		= $(this).val();
	    	LoadTable(start, end);
	    });

	    

	    function GetInfo(start_date, end_date){
		    
			$.ajax({
				url: aJaxURL,
				data: "act=get-info&start_date=" + start_date + "&end_date=" + end_date,       
				success: function(data) {
					if (data.error != "") {
	                    alert(data.error);
	                } else {
	                	$("#get-info").html(data.page);	

	                    $( ".sales" ).tooltip({
	                        hide: {
	                          effect: "explode",
	                          delay: 250
	                        }
	                      });
	                }
				}
			});
			
	    }
	    
    </script>
</head>

<body>    
    <div id="dt_example" class="ex_highlight_row">
        <div id="container" style="width:99%">
            <div id="dynamic">
            	<h2 align="center">თანხის მოძრაობა</h2>
            	<div id="button_area" style="margin-bottom:90px;">
	            	<div class="left" style="width: 175px;">
	            		<input type="text" name="search_start" id="search_start" class="inpt right"/>
	            	</div>
	            		<label for="search_start" class="left" style="margin:5px 0 0 3px">-დან</label>
	            	<div class="left" style="width: 185px;">
	            		<input type="text" name="search_end" id="search_end" class="inpt right" />
            		</div>
            			<label for="search_end" class="left" style="margin:5px 0 0 3px">–მდე</label>
            		<br /><br /><br />
            		<div id="get-info">

            			
            		</div>
            	</div>
                <table class="display" id="report">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">თარიღი</th>
                            <th style="width: 110px;">დრო</th>
                            <th>შემოსავალი</th>
                           	<th>გასავალი</th>
                           	<th style="width: 110px;">ავტ. №</th>
                           	<th style="width: 140px;">მოწ.თანხა</th>
                           	<th style="width:110px;">ხურდა</th>
                           	<th style="width:140px;">ანგ.ფორმა</th>
                           	<th style="width:180px;">მომხმარებელი</th>
                           	<th>სალარო</th>
                           	<th style="width:100px;">ფილიალი</th>
                           	<th>შენიშვნა</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_date" name="search_name" value="ფილტრი" class="search_init" />
                            </th>                            
                            <th>
                                <input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                            
                            </th>                         
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                            
                            </th>                                                                        
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                            
                            </th>  
                             <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                             
                            </th>  
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                            
                            </th>        
 							<th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" /> 							
                            </th>  
                             <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                             
                            </th>  
                            <th>
                           		<input type="text" id="search_name" name="search_name" value="ფილტრი" class="search_init" />                            
                            </th>                                                                        
                        </tr>
                    </thead>  
                    <tfoot>
                        <tr>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th><p align="right">ჯამი:<br/>სულ ჯამი:</th>
                            <th>&nbsp;</th>  
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th> 
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>                           
                            <th>&nbsp;</th>                                                    
                        </tr>
                    </tfoot>
                </table>
            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
    
        <!-- jQuery Dialog -->
    <div id="add-edit-form" class="form-dialog" title="ოპერაციის ინფორმაცია">
    	<!-- aJax -->
	</div>
</body>
</html>